"use strict";

const db = uniCloud.database();

exports.main = async (event, context) => {
	try {
		const col = db.collection('app_config');
		const { data } = await col.limit(1).get();
		if (Array.isArray(data) && data.length > 0) {
			return { code: 0, data: data[0] };
		}
	} catch(e) {}
	return {
		code: 0,
		data: {
			configVersion: 2,
			mbti: { low: 1, medium: 1, high: 1 },
			mbtiTarget: { low: 16, medium: 48, high: 96 },
			tarot: { major: 1 },
			spreads: {
				single: { positions: [{ index: 0, label: "整体" }] },
				three: { positions: [ { index: 0, label: "过去" }, { index: 1, label: "现在" }, { index: 2, label: "未来" } ] }
			}
		}
	};
}; 